import { ConverterBase } from './base';
import { Sprite, Toggle } from './cc';

export class ToggleConverter extends ConverterBase {
    public static prefix = 'toggle-';

    public async convert() {
        const node = this.createNode();

        await this.addChildren(node);

        const toggle = this.appendComponent(Toggle, node);
        toggle.checkMark = node.children[0].getComponent(
            ConverterBase.getCcPropFunc(Sprite.name),
        );

        return node;
    }
}